program ShakerSort;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
i, j, n: integer;
mass: array of integer;
fin, fout: textFile;
flag: boolean;

begin
  assignFile (fin, 'input.txt');
  reset (fin);
  assignFile (fout, 'output.txt');
  rewrite (fout);
  readln(fin, n);
  setlength (mass, n);
  for i:= 0 to n-1 do
    read(fin, mass[i]);
  for j:= 1 to n div 2 do
  begin
    flag:= true;
    for i:= j-1 to n-j-1 do
      if (mass[i] > mass[i+1]) then
      begin
        mass[i]:= mass[i]+mass[i+1];
        mass[i+1]:= mass[i]-mass[i+1];
        mass[i]:= mass[i]-mass[i+1];
        flag:= false;
      end;
    for i:= n-j-1 downto j-1 do
      if (mass[i] > mass[i+1]) then
      begin
        mass[i]:= mass[i]+mass[i+1];
        mass[i+1]:= mass[i]-mass[i+1];
        mass[i]:= mass[i]-mass[i+1];
        flag:= false;
      end;
    if (flag) then
    break;
  end;
  for i:= 0 to n-1 do
    write(fout, mass[i], ' ');
  closeFile (fin);
  closeFile (fout);
end.
